Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(update): refactored code to make it more readable #36

Closed
wants to merge 1 commit into from

Conversation

mardev-xyz
Copy link
Contributor

refactored code + removed math.randomseed since it wasn't getting used anywhere

local xPlayer = ESX.GetPlayerFromId(source)
local timeNow = os.clock()

if not xPlayer.job.name == 'taxi' then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be ~=

end
end)

ESX.RegisterServerCallback("esx_taxijob:SpawnVehicle", function(source, cb, model , props)
local xPlayer = ESX.GetPlayerFromId(source)

if xPlayer.job.name ~= "taxi" then
if not xPlayer.job.name == "taxi" then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here use ~=

local xPlayer = ESX.GetPlayerFromId(source)

if not xPlayer.job.name == 'taxi' then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here ~=

-- is there enough in the society?
if count > 0 and item.count >= count then
-- can the player carry the said amount of x item?
if xPlayer.canCarryItem(itemName, count) then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be
if not xPlayer.canCarryItem(itemName, count) then
return xPlayer.showNotification(TranslateCap('player_cannot_hold'))
end

-- rest of the code here

local item = inventory.getItem(itemName)

-- is there enough in the society?
if count > 0 and item.count >= count then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here should get rid of nestling

@Arctos2win Arctos2win closed this Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants